#include "RealTime_apiv1.h"
#include "RealTime_callback.h"
#include "app_common.h"
#include "Video.h"
#include "Audio.h"
#include "DevManager.h"
#include "PowerManager.h"
#include "DevSocSub.h"
#include "Daemon.h"
#include "Net.h"
#include "DevWifi.h"
#include "System.h"
#include "ConfigSubOps.h"
#include "DevConfig.h"

#define BR_HDMODE 0    
#define BR_SDMODE 1    	
#define BR_LUMODE 2   

int32_t RealTimeGetUUID_Callback(char uuid[RT_UUID_LEN])
{
    if (uuid == NULL) {
        LOGE("uuid is null\n");
        return -1;
    }
    
	memset(uuid, 0, RT_UUID_LEN);	
	//strncpy(uuid,"2000545960005855", 16);
	if( 0 > DevGetUuid(uuid) || uuid[0] == '0' || uuid[0] == 0 ) {
        return -1;
	}
	return 0;
}

//SuggestBitRate:推荐码率,可忽视
int32_t RealTimeVideoOpen_Callback(uint8_t channel,RT_EncodeMode eCodeMode,uint32_t SuggestBitRate,RealTimeVideoDataFormat* videoinfo)
{	
	//save suggest videocfg
#if 0
	int Ret    = 0;
	int nfps   = 0;
	int igop   = 0;

	uint32_t BitRate = SuggestBitRate;
	
	CConfigEncode* pCfgEncode = new CConfigEncode();
	pCfgEncode->update();
	CONFIG_ENCODE& cfgEncode = pCfgEncode->getConfig();

	Get_Video_Nfps_Igop(&nfps, &igop);

	videoinfo->codec 									= RT_CODEC_H264;
	videoinfo->framerate 								= nfps;
	videoinfo->frameInterval 							= igop;
	cfgEncode.dstMainFmt[ENCODE_TYPE_TIM].vfFormat.iGOP = igop;
	cfgEncode.dstMainFmt[ENCODE_TYPE_TIM].vfFormat.nFPS = nfps;

	videoinfo->colorDepth		= 24;

	switch(eCodeMode)
	{
		case RT_HDMODE:
			LOGD("RT_HDMODE 1080P\n");
			cfgEncode.dstMainFmt[ENCODE_TYPE_TIM].vfFormat.iResolution  = CAPTURE_SIZE_720P;
			BitRate = 800;
			videoinfo->width  = 1280;
			videoinfo->height = 720;
			cfgEncode.dstMainFmt[ENCODE_TYPE_TIM].vfFormat.iQuality = 1;			
			break;
		case RT_SDMODE:
			LOGD("RT_SDMODE 720P\n");			
			cfgEncode.dstMainFmt[ENCODE_TYPE_TIM].vfFormat.iResolution	= CAPTURE_SIZE_360P;
			BitRate = 512;
			videoinfo->width  = 640;
			videoinfo->height = 360;
			cfgEncode.dstMainFmt[ENCODE_TYPE_TIM].vfFormat.iQuality = 2;				
			break;
		case RT_LUMODE:
			LOGD("RT_LUMODE 360P\n");			
			cfgEncode.dstMainFmt[ENCODE_TYPE_TIM].vfFormat.iResolution	= CAPTURE_SIZE_360P;
			BitRate = 256;
			videoinfo->width  = 640;
			videoinfo->height = 360;
			cfgEncode.dstMainFmt[ENCODE_TYPE_TIM].vfFormat.iQuality = 3;		
			break;
		default:
			Ret = -1;
			break;
	}
	cfgEncode.dstMainFmt[ENCODE_TYPE_TIM].vfFormat.nBitRate 	= BitRate;
	videoinfo->bitrate =  BitRate;
	if(Ret != -1)	pCfgEncode->commit();

	delete pCfgEncode;
#endif
	return 0;
}

static RT_EncodeMode s_Format = RT_LUMODE;

#define  B1_VIDEO_FPS          15
#define  B1_VIDEO_GOP         (15*2)
#define  B1_VIDEO_COLORDEPTH   24

#define  B1_VIDEO_HD_WIDTH     1920
#define  B1_VIDEO_HD_HEIGHT    1080
#define  B1_VIDEO_HD_BITRATE   800

#define  B1_VIDEO_SD_WIDTH     1280
#define  B1_VIDEO_SD_HEIGHT    720
#define  B1_VIDEO_SD_BITRATE   512

#define  B1_VIDEO_LU_WIDTH     640
#define  B1_VIDEO_LU_HEIGHT    360
#define  B1_VIDEO_LU_BITRATE   256

int32_t RealTimeSetVideoInfo_Callback(uint8_t channel,RT_EncodeMode eCodeMode,uint32_t SuggestBitRate, RealTimeVideoDataFormat* videoinfo) //设置分辨率
{	
	int Ret 		 = 0;
    uint32_t BitRate = SuggestBitRate;
    VIDEO_STREAM_ATTR_S stStreamAttr;
    
	//set  videocfg to bsp
	//save videocfg to cfgfile

	videoinfo->codec = RT_CODEC_H264;
	videoinfo->colorDepth = B1_VIDEO_COLORDEPTH;
	videoinfo->framerate = B1_VIDEO_FPS;
	videoinfo->frameInterval = B1_VIDEO_GOP;
	
	switch(eCodeMode)
	{
		case RT_HDMODE:
			LOGD("RT_HDMODE 1080\n");
			BitRate = B1_VIDEO_HD_BITRATE;
			videoinfo->width  = B1_VIDEO_HD_WIDTH;
			videoinfo->height = B1_VIDEO_HD_HEIGHT;

			break;
		case RT_SDMODE:
			LOGD("RT_SDMODE 720\n");			
			BitRate = B1_VIDEO_SD_BITRATE;
			videoinfo->width  = B1_VIDEO_SD_WIDTH;
			videoinfo->height = B1_VIDEO_SD_HEIGHT;
			break;
		case RT_LUMODE:
			LOGD("RT_LUMODE 360\n");			
			BitRate = B1_VIDEO_LU_BITRATE;
			videoinfo->width  = B1_VIDEO_LU_WIDTH;
			videoinfo->height = B1_VIDEO_LU_HEIGHT;
			break;
		default:
			Ret = -1;
			break;
	}

    memset(&stStreamAttr, 0, sizeof(stStreamAttr));
    stStreamAttr.bitrate = BitRate;
    stStreamAttr.width = videoinfo->width;
    stStreamAttr.height = videoinfo->height;
    stStreamAttr.framerate = videoinfo->framerate;

	Ret = VideoGetOpsHandle()->set_resolution(channel, stStreamAttr);
	if (Ret < 0) {
        LOGE("set_resolution chn:%d failed\n", channel);
        return -1;
	}
	s_Format = eCodeMode;
	return 0;
}

int32_t RealTimeGetVideoCurInfo_Callback(uint8_t channel,RT_EncodeMode *pCodeMode, RealTimeVideoDataFormat* videoinfo)
{
	//get cfg from cfgfile
	LOGD("RealTimeGetVideoCurInfo_Callback\n");
	switch (s_Format)
	{
		case 1: 
			*pCodeMode = RT_HDMODE;
			videoinfo->width  = B1_VIDEO_HD_WIDTH;
			videoinfo->height = B1_VIDEO_HD_HEIGHT;
			videoinfo->bitrate = B1_VIDEO_HD_BITRATE;
			break;
		case 2:
			*pCodeMode = RT_SDMODE;
			videoinfo->width  = B1_VIDEO_SD_WIDTH;
			videoinfo->height = B1_VIDEO_SD_HEIGHT;
			videoinfo->bitrate = B1_VIDEO_SD_BITRATE;
			break;
		case 3:
			*pCodeMode = RT_LUMODE;
			videoinfo->width  = B1_VIDEO_LU_WIDTH;
			videoinfo->height = B1_VIDEO_LU_HEIGHT;
			videoinfo->bitrate = B1_VIDEO_LU_BITRATE;
			break;
		default : 
			break;
	}

	videoinfo->codec 			= RT_CODEC_H264;
	videoinfo->framerate 		= B1_VIDEO_FPS;
	videoinfo->frameInterval 	= B1_VIDEO_GOP;
	videoinfo->colorDepth       = B1_VIDEO_COLORDEPTH;
	return 0;
}

int32_t RealTimeVideoClose_Callback(uint8_t channel)
{	
	//stop video
	LOGD("RealTimeVideoClose_Callback\n");
	return 0;
}

int32_t RealTimeAudioOpen_CallBack(uint8_t channel,RealTimeAudioDataFormat* audioinfo)
{
	LOGD("RealTimeAudioOpen_CallBack\n");
	audioinfo->samplesRate = 16000;
	audioinfo->bitrate = 16;
	audioinfo->waveFormat = RT_WAVE_FORMAT_G711;
	audioinfo->channelNumber = channel;	
	audioinfo->blockAlign = 1;
	audioinfo->bitsPerSample =16;
	audioinfo->frameInterval = 62;
	//start andio
	//g_LiveCamTrans.StartAudio(0);
	return 0;
}
int32_t RealTimeAudioClose_CallBack(uint8_t channel)
{
	LOGD("RealTimeAudioClose_CallBack\n");
	//stop audio
	return 0;
}

int32_t RealTimeFileListPerPage_Callback(uint8_t channel,RTFileListPerPage *FilePage,int NumsOfPerPage,char LastFileName[64])
{
	LOGD("RealTimeFileListPerPage_Callback\n");
	//Query record by page
	return 0;
}

int32_t RealTimeQueryRecordFile_Callback(uint8_t channel,uint8_t ReType,QueryRecordTime FileTime,RTFileListPerPage_2 *FilePage)
{
	LOGD("RealTimeQueryRecordFile_Callback\n");
	//Query Record
	return 0;
}

int32_t RealTimeQueryRecordPage_Callback(uint8_t channel,uint8_t ReType,uint32_t StartStamp,uint32_t EndStamp
	,uint32_t Page,uint32_t PageNum,RTFileListPerPage_3 *FilePage)
{
	LOGD("RealTimeQueryRecordPage_Callback\n");
	//QueryRecordPage
	return 0;
}

int32_t RealTimeQueryRecordTimeList_Callback(uint8_t channel,uint32_t startTime, uint32_t endTime, uint32_t **timeList)
{
	LOGD("RealTimeQueryRecordTimeList_Callback\n");
	//QueryRecordTimeList
	return 0;
}

int32_t RealTimeRecordOpen_CallBack(uint8_t channel,char*  recordname,RealTimeVideoDataFormat* videoinfo, RealTimeAudioDataFormat* audioinfo,uint32_t* FileTotalTime)
{
	LOGD("RealTimeRecordOpen_CallBack\n");
	//open file and Fill audio and video record cfg
	return 0;
}
int32_t RealTimeRecordCotrol_CallBack(uint8_t channel,CONTROLTYPE type,uint32_t value)
{	
	LOGD("RealTimeRecordCotrol_CallBack\n");
	//control percent
	return 0;
}

int32_t RealTimeRecordFileDelete_CallBack(char RecordFileName[64])
{
	LOGD("RealTimeRecordFileDelete_CallBack\n");
	//delete record file
	return 0;
}

int32_t RealTimeReBoot_CallBack()
{
	LOGD("RealTimeReBoot_CallBack\n");
	//save cfg and close record
	SystemReboot("RealTimeReBoot_CallBack");
	return 0;
}

int32_t RealTimeGetFileSavePath_Callback(RTSystemFilePath *path) //返回存储目录
{
	int ret = 0;
	switch(path->type)
	{
		case RTMPADDR:   //流地址保存目录
		case LiveMuteSta://声音开关保存目录
		case STREAMID:   //StreamId保存目录
			snprintf(path->FilePath, 128, "%s/temp",PATH_UPGRADE_DIR_APP);
			break;
		case UPGRADEPATH:
			snprintf(path->FilePath, 128, "%s", PATH_UPGRADE_DIR_APP);//升级目录
			break;
		default:
			ret = 1;
			break;
	}
	return ret;
}

int32_t RealTimeLiteosUpgradeInit_Callback(int nFileSize)
{
	LOGD("RealTimeLiteosUpgradeInit_Callback %d\n", nFileSize);
	UpgradeInit(nFileSize);           //init upgrate 
	return 0;
}

int32_t RealTimeUpgrade_Callback(char UpgradeFile[128])
{
	LOGD("RealTimeUpgrade_Callback %s\n", UpgradeFile);

	UpgradeRun(UpgradeFile);    //init  downfile upgrade
	UpgradeDeinit();

	SystemReboot("RealTimeUpgrade_Callback upgrade success");
	return 0;
}

int32_t RealTimeGetDevVersion_Callback(char Version[64])
{
	LOGD("RealTimeGetDevVersion_Callback\n");

    if (Version == NULL) {
        LOGE("Version is null\n");
        return -1;
    }
    
	return DevGetSoftVersion(Version);
}

int32_t RealTimeGetSDInfo_Callback(RTSDInfo *info) //SD卡容量，剩余容量
{
	if(NULL == info)  return 1;
	LOGD("RealTimeGetSDInfo_Callback\n");
#if 0
	int Remainmem 		= 0;
	int Totalmem 		= 0;
	int ret 			= -1;
	RTFileListPerPage filelist;
	static char EarlyFileTime[64] ={0};

	static unsigned long CurTime = 0;
	static unsigned long LastTime= 0;
	
	ret = file_sys_get_cap(&Totalmem,&Remainmem);
	
	CurTime = time(NULL);

	//删除过文件再查询
	if(g_DelFileFlag)
	{
		//FFFile.cpp 删除过SD卡文件
		memset(EarlyFileTime,0,64);
	}

	if(ret != -1)
	{
		if(FS_WRITE_ERROR == g_DriverManager.GetSDStatus()){
			info->SDExist 		= 2;
		}
		else{
			info->SDExist 		= 1;	
		}
		info->SDTotalSize 	= Totalmem/1024; //MB
        info->SDFreeSize 	= Remainmem/1024;//MB	
		if(EarlyFileTime[0] == 0){
			GetEarilestVideoFile(&filelist);
			if(filelist.FileCount > 0){
				memset(info->EarlyFileName,0,sizeof(info->EarlyFileName));
				strncpy(info->EarlyFileName,filelist.fileinfo[filelist.FileCount - 1].FileCreateTime,64);
				strncpy(EarlyFileTime,info->EarlyFileName,64);
				g_DelFileFlag = 0;
			}
		}
		else{
			strncpy(info->EarlyFileName,EarlyFileTime,64);
		}		
	}
	else
	{
		if(file_sys_get_linkstat() < 0){
			info->SDExist 		= 0;
		}
		else{ //卡异常
			info->SDExist 		= 2;
		}
	}
#endif
	return 0;
}

int32_t RealTimeSetSleepStatu(int32_t enable)
{
	LOGD("RealTimeSetSleepStatu enable=%d\n", enable);
	if(enable){
		//g_DevExternal.Dev_EnableSleepMode();
	}else{
		//g_DevExternal.Dev_UnableSleepMode();
	}
	return 0;
}

int32_t RealTimeSleepIpcam()
{
	LOGD("RealTimeSleepIpcam\n");
	//g_DevExternal.Dev_EnableSleepMode();
	//g_DevExternal.PaassCMDSleepMode();	
	return 0;
}

int32_t RealTimeGetTimePIRWorkSheet(RT_WORKSHEET *pPirWorkSheet)
{
	LOGD("RealTimeGetTimePIRWorkSheet\n");
	#if 0
	CConfigAwakeTime* pAwe = new CConfigAwakeTime();
	int hour,min,sec;

	pAwe->update();

	for(int i = 0;i < WDAYS && i < RT_WEEKS ; i++)
	{
		CONFIG_AWAKETIME& m_cfg = pAwe->getConfig(i);

		pPirWorkSheet->partSwitch[i] = RT_UNABLE;
		for(int j = 0;j < UNITS && j < RT_TSECT; j++)
		{	
			if(m_cfg.DayPlan[j].Enable == TRUE)
			{
				pPirWorkSheet->tsSchedule[j].enable = RT_ENABLE;
					
				hour = (m_cfg.DayPlan[j].StartTime >> 16)&0xff;
				min  = (m_cfg.DayPlan[j].StartTime >>  8)&0xff;
				sec  =  m_cfg.DayPlan[j].StartTime&0xff;

				_printd("Start[%02d:%02d:%02d]",hour,min,min);
				pPirWorkSheet->tsSchedule[j].startHour  = hour;
				pPirWorkSheet->tsSchedule[j].startMinute= min;
				pPirWorkSheet->tsSchedule[j].startSecond= sec;

				hour = (m_cfg.DayPlan[j].EndTime >> 16)&0xff;
				min  = (m_cfg.DayPlan[j].EndTime >>  8)&0xff;
				sec  =  m_cfg.DayPlan[j].EndTime&0xff;		
				
				_printd("End[%02d:%02d:%02d]",hour,min,min);
				pPirWorkSheet->tsSchedule[j].endHour  = hour;
				pPirWorkSheet->tsSchedule[j].endMinute= min;
				pPirWorkSheet->tsSchedule[j].endSecond= sec;
				
				pPirWorkSheet->partSwitch[i] = RT_ENABLE;
			}
			else{
				pPirWorkSheet->tsSchedule[j].enable = RT_UNABLE;
			}
		}
	}
	#endif
	return 0;
}

int32_t RealTimeSetTimePIRWorkSheet(RT_WORKSHEET PirWorkSheet)
{
	LOGD("RealTimeSetTimePIRWorkSheet\n");
	#if 0
	CConfigAwakeTime* pAwe = new CConfigAwakeTime();
	int hour,min,sec;

	_printd("RealTimeSetTimePIRWorkSheet");

	pAwe->update();

	for(int i = 0;i < WDAYS && i < RT_WEEKS ; i++)
	{
		CONFIG_AWAKETIME& m_cfg = pAwe->getConfig(i);

		for(int j = 0;j < UNITS && j < RT_TSECT; j++)
		{	
			if(RT_ENABLE == PirWorkSheet.tsSchedule[j].enable &&
			   RT_ENABLE == PirWorkSheet.partSwitch[i]){
				m_cfg.DayPlan[j].Enable = TRUE;
			}
			else{
				m_cfg.DayPlan[j].Enable = FALSE;
			}

			hour = PirWorkSheet.tsSchedule[j].startHour;
			min  = PirWorkSheet.tsSchedule[j].startMinute;
			sec  = PirWorkSheet.tsSchedule[j].startSecond;

			m_cfg.DayPlan[j].StartTime = (hour << 16) | (min << 8) | sec;
			
			hour = PirWorkSheet.tsSchedule[j].endHour;
			min  = PirWorkSheet.tsSchedule[j].endMinute;
			sec  = PirWorkSheet.tsSchedule[j].endSecond;
			
			m_cfg.DayPlan[j].EndTime   = (hour << 16) | (min << 8) | sec;
			if(PirWorkSheet.tsSchedule[j].enable == TRUE){
				_printd("StartTime :%d EndTime :%d",m_cfg.DayPlan[j].StartTime,m_cfg.DayPlan[j].EndTime);
			}
		}
	}

	pAwe->commit();
	#endif
	return 0;
}

int32_t  RealTimeGetElectricity(RT_BAT_Status *pEle)
{
	LOGD("RealTimeGetElectricity\n");
	BATTERY_STATUS_S stBatStatus;
	memset(&stBatStatus, 0, sizeof(stBatStatus));

	if(0 != SocSubGetBatteryStatus(&stBatStatus)){
		LOGE("SocSubGetBatteryStatus fail\n");
		return -1;
	}
	pEle->capacity 				= stBatStatus.capacity;
	pEle->chargingStatus 		= stBatStatus.chargingStatus;
	pEle->isLowBatState 		= stBatStatus.isLowBatState;
	return 0;
}

int32_t RealTimeGetDeviceInfo(RT_DeviceInfo *pDevInfo)
{
	if(NULL == pDevInfo)  return 1;

	LOGD("RealTimeGetDeviceInfo\n");
    
	memset(pDevInfo, 0, sizeof(RT_DeviceInfo));
	
    WIFI_STATUS_INFO_S stWifiStatus;
    memset(&stWifiStatus, 0, sizeof(stWifiStatus));
	WifiGetStatus(&stWifiStatus);
	snprintf(pDevInfo->WifiName, sizeof(pDevInfo->WifiName), "%s", stWifiStatus.ssid);
	pDevInfo->WifiValue = stWifiStatus.signalLevel;
	LOGD("==>>wifiname=%s value=%d\n", pDevInfo->WifiName, pDevInfo->WifiValue);

	DevGetProductModel(pDevInfo->DevType, sizeof(pDevInfo->DevType));
	DevGetSoftVersion(pDevInfo->SystemVersion);
	
	DevGetNumber(pDevInfo->DeviceNum, sizeof(pDevInfo->DeviceNum));
	LOGD("==>>type=%s version=%s num=%s\n", pDevInfo->DevType, pDevInfo->SystemVersion, pDevInfo->DeviceNum);

    NET_ATTR_INFO_S stNetAttrInfo;
    memset(&stNetAttrInfo, 0, sizeof(stNetAttrInfo));
    NetGetAttrInfo("wlan0", &stNetAttrInfo);
    snprintf(pDevInfo->IpAddr, sizeof(pDevInfo->IpAddr), "%s", stNetAttrInfo.ip);
    snprintf(pDevInfo->MacAddr, sizeof(pDevInfo->MacAddr), "%s", stNetAttrInfo.mac);
	LOGD("==>>ip=%s mac=%s\n", pDevInfo->IpAddr, pDevInfo->MacAddr);
	return 0;
}

int32_t RealTimeWifiGetLinkStatus()
{
	return WifiCheckIsConnected();
}

int32_t RealTimeSetTimeZone_Callback(RT_TimeZoneInfo zoneInfo)
{
	LOGE("RealTimeSetTimeZone_Callback Settimezone = %d DaylightEnable:%d,(%d,%d)\n",zoneInfo.ZoneSec,
		zoneInfo.DayTimeInfo.Enable,zoneInfo.DayTimeInfo.StartTime,zoneInfo.DayTimeInfo.EndTime);

	SYS_TIMEZONE_INFO_S stTimeZoneInfo;
	stTimeZoneInfo.zoneSec = zoneInfo.ZoneSec;
	stTimeZoneInfo.stDayLightTime.bEnable = zoneInfo.DayTimeInfo.Enable;
	stTimeZoneInfo.stDayLightTime.startTime = zoneInfo.DayTimeInfo.StartTime;
	stTimeZoneInfo.stDayLightTime.endTime = zoneInfo.DayTimeInfo.EndTime;
	memcpy(stTimeZoneInfo.reserved, zoneInfo.ExtData, sizeof(stTimeZoneInfo.reserved));

    TIMEZONE_CONFIG stTimeZone;
    memset(&stTimeZone, 0, sizeof(stTimeZone));
    stTimeZone.zoneSec = stTimeZoneInfo.zoneSec;
    stTimeZone.bEnable = stTimeZoneInfo.stDayLightTime.bEnable;
    stTimeZone.startTime = stTimeZoneInfo.stDayLightTime.startTime;
    stTimeZone.endTime = stTimeZoneInfo.stDayLightTime.endTime;
    return DevConfigSetTimeZone(stTimeZone);
}

int32_t RealTimeGetTimeZone_Callback(RT_TimeZoneInfo* pZoneInfo)
{
    TIMEZONE_CONFIG stTimeZone;
    memset(&stTimeZone, 0, sizeof(stTimeZone));
    DevConfigGetTimeZone(&stTimeZone);
	pZoneInfo->ZoneSec = stTimeZone.zoneSec;
	pZoneInfo->DayTimeInfo.Enable = stTimeZone.bEnable;
	pZoneInfo->DayTimeInfo.StartTime = stTimeZone.startTime;
	pZoneInfo->DayTimeInfo.EndTime = stTimeZone.endTime;

	LOGD("RealTimeGetTimeZone_Callback timezone=%d DaylightEnable:%d,(%d,%d)\n",
		 pZoneInfo->ZoneSec, pZoneInfo->DayTimeInfo.Enable,
		 pZoneInfo->DayTimeInfo.StartTime, pZoneInfo->DayTimeInfo.EndTime);
	
	return 0;
}

int32_t RealTimeAudioPlayStart_Callback(AUDIOPLY_TYPE EncordType,int32_t SampleRate,
			int32_t BitWidth,uint32_t Volume,int Priority/*the biger ,the higher*/)
{
	LOGD("RealTimeAudioPlayStart_Callback\n");

	return AudioTalkPlaySet(EncordType ,SampleRate ,BitWidth ,Volume);
}

int32_t RealTimeAudioPlayProGress_Callback(uint8_t* buf, int32_t size)
{
	LOGD("RealTimeAudioPlayProGress_Callback\n");

	return AudioTalkPlayFrame(buf, size);
}

int32_t RealTimeAudioPlayStop_Callback(void)
{
	LOGD("RealTimeAudioPlayStop_Callback\n");
	
	return AudioTalkPlayFinish();
}

int32_t RealTimeImageMirrorFlip_Callback(MirrorFlip direct)
{
	LOGD("RealTimeImageMirrorFlip_Callback\n");
#if 0
	CConfigCamera ConfigCamera ;
	ConfigCamera.update();

	CONFIG_CAMERA& cfgCamera = ConfigCamera.getConfig();

	switch (direct){
	case NORMAL:
		cfgCamera.HorReverse = 0;
		cfgCamera.VerReverse = 0;

		LOGD("The direction of image is NORMAL\n");
		break;
	case HORFLIP:
		cfgCamera.HorReverse = 1;
		cfgCamera.VerReverse = 0;

		LOGD("The direction of image is HORFLIP\n");
		break;
	case VERFLIP:
		#if 1 //在APP 改之前，垂直翻转暂时用 水平垂直一起翻转，以解决机器倒装镜像bug
		cfgCamera.HorReverse = 0;
		cfgCamera.VerReverse = 1;

		LOGD("The direction of image is VERFLIP\n");
		break;
		#endif //----20181210  LHC add
	case HORVERFLIP:
		cfgCamera.HorReverse = 1;
		cfgCamera.VerReverse = 1;

		LOGD("The direction of image is HORVERFLIP\n");
		break;
	default :
		cfgCamera.HorReverse = 0;
		cfgCamera.VerReverse = 0;
		break;
	}
	ConfigCamera.commit();
#endif
	return 0;
}

int32_t RealTimeImageGetMirrorFlip_Callback(MirrorFlip *pdirect)
{
	LOGD("RealTimeImageGetMirrorFlip_Callback\n");
	#if 0
	CConfigCamera ConfigCamera ;
	ConfigCamera.update();

	CONFIG_CAMERA& cfgCamera = ConfigCamera.getConfig();
	if (0 == cfgCamera.HorReverse && 0 == cfgCamera.VerReverse)
	{	
		*pdirect = NORMAL;
	}
	else if (cfgCamera.HorReverse && 0 == cfgCamera.VerReverse)
	{
		*pdirect = HORFLIP;
	}
	else if (0 == cfgCamera.HorReverse && cfgCamera.VerReverse)
	{
		*pdirect = VERFLIP;
	}
	else if(cfgCamera.HorReverse && cfgCamera.VerReverse)
	{
		*pdirect = HORVERFLIP;
	}
	#endif
	return 0;
}

int32_t RealTimeSetSDCardFormat_Callback()
{
	LOGD("RealTimeSetSDCardFormat_Callback");
	return 0;
}

int32_t RealTimeSetDevSleepSta(int32_t Enable,int32_t Val)
{
	LOGD("RealTimeSetDevSleepSta %d, Val:%d\n",Enable,Val);
	if(Enable)
	{
		PowerSetSocSleepTime(AV_TRUE, Val);
	}
	else
	{
		PowerSetSocSleepTime(AV_FALSE, 60);
	}
	return 0;
}

int32_t RealTimeConnectWifi_Callback(char* Ssid,char* Passwd)
{
	LOGD("RealTimeConnectWifi_Callback Ssid:%s ,Passwd:%s\n",Ssid,Passwd);
	#if 0
	if(FALSE == CheckSsid(Ssid,strlen(Ssid))) {
		return 1;		
	}

	if (Passwd == NULL || strlen(Passwd) <= 0) {
		Store_Cfgfile(STORE_WIFI_CONFIG,Ssid,NULL);
	} else {
		Store_Cfgfile(STORE_WIFI_CONFIG,Ssid,Passwd);
	}
	#endif
	return 0;
}

int32_t RealTimeForceIFrame_Callback()
{	
	LOGD("RealTimeForceIFrame_Callback>>>...\n");
	
	VideoGetOpsHandle()->request_idr_frame(0);
	
	return 0;
}

int32_t RealTimePwdAuth_Callback(char* username, char* pwd)
{
	LOGD("RealTimePwdAuth_Callback\n");
	#if 0
	int ret = 0;
	if(6 != strlen(pwd))
	{
		LOGD("size is not 6!\n");
		return -1;
	}
	ret = g_userManager.isPasswdValid("guest",pwd,needEncrypt,0);
	if(ret)
	{
		LOGD("pwd ok!\n");
		return 0;
	}
	LOGD("pwd fail!\n");
	#endif
	return 0;
}

int32_t RealTimeResetUsrPsword_Callback(char* username, char* oldpwd, char* newpwd)
{
	LOGD("RealTimeResetUsrPsword_Callback\n");
	#if 0
	int ret = 0;
	
	if(0 == strcmp("6666superpw6666",oldpwd))
	{
		//应pass要求重新绑定修改为默认密码
		g_userManager.modPassword("guest",newpwd,needEncrypt);
		return 0;
	}
	if((6 != strlen(oldpwd)) || (6 != strlen(newpwd)))
	{
		LOGD("size is not 6!\n");
		return 1;
	}
	ret = g_userManager.isPasswdValid("guest",oldpwd,needEncrypt,0);
	if(ret)
	{
		g_userManager.modPassword("guest",newpwd,needEncrypt);
	}
	else
	{
		_printd("old pwd novalid!!!!");
		return 1;
	}
	#endif
	return 0;
}

/*0:open 1:close*/
int32_t  RealTimeGetLedStatus()
{
	LOGD("RealTimeGetLedStatus\n");
	//return g_ledstat.GetLedSwitch();
	return 0;
}

//AI update
int32_t  RealTimeSetAiUploadFreq(RT_UpLoadFaceFreqinfo FreqInfo)
{
	LOGD("RealTimeGetLedStatus\n");
	return 0;
}
int32_t  RealTimeGetAiUploadFreq(RT_UpLoadFaceFreqinfo *FreqInfo)
{
	LOGD("RealTimeGetAiUploadFreq\n");
	return 0;
}

int32_t RealTimeResetAllConfigure()
{
	LOGD("RealTimeResetAllConfigure\n");
	
	SYS_TIMEZONE_INFO_S stTimeZoneInfo;
	//timezone def=+8
	memset(&stTimeZoneInfo, 0, sizeof(SYS_TIMEZONE_INFO_S));
    stTimeZoneInfo.zoneSec = 8 * 3600;

    TIMEZONE_CONFIG stTimeZone;
    memset(&stTimeZone, 0, sizeof(stTimeZone));
    stTimeZone.zoneSec = stTimeZoneInfo.zoneSec;
    stTimeZone.bEnable = stTimeZoneInfo.stDayLightTime.bEnable;
    stTimeZone.startTime = stTimeZoneInfo.stDayLightTime.startTime;
    stTimeZone.endTime = stTimeZoneInfo.stDayLightTime.endTime;
    DevConfigSetTimeZone(stTimeZone);

    DevConfigSetPirSwitch(1);

    PLAY_VOLUME_CONFIG stPlayVol = {100, 100, 100, 60};
    AudioGetOpsHandle()->set_play_volume(stPlayVol);
    
	return 0;
}

int32_t RealTimeResetNetWork()
{
	LOGD("RealTimeResetNetWork\n");

	WifiSetDefaultConfig();

	PowerSetSocSleepTime(1, 1);
	
	return 0;
}

int32_t RealTimeSetAlarmSwtich(RTAlarmSwitch Switch)
{
	LOGD("RealTimeSuspend_Callback\n");
	#if 0
	CConfigAlarmSwitch cfgAlarmSwitch;
	cfgAlarmSwitch.update();
	CONFIG_ALARMSWITCH &cfgSwitch = cfgAlarmSwitch.getConfig();
	
	if(Switch.AlarmSwitch_Cry != RT_ALARM_REMAIN){
		cfgSwitch.bCryEnable = Switch.AlarmSwitch_Cry;
	}
	if(Switch.AlarmSwitch_Motion != RT_ALARM_REMAIN){
		cfgSwitch.bMotionEnable = Switch.AlarmSwitch_Motion;
	}
	if(Switch.AlarmSwitch_Human != RT_ALARM_REMAIN){
		cfgSwitch.bHumanEnable = Switch.AlarmSwitch_Human;
	}
	if(Switch.AlarmSwitch_Voice != RT_ALARM_REMAIN){
		cfgSwitch.bVoiceEnable = Switch.AlarmSwitch_Voice;
	}
	if(Switch.AlarmSwitch_Trace != RT_ALARM_REMAIN){
		cfgSwitch.bTraceEnable = Switch.AlarmSwitch_Trace;
	}	

	cfgAlarmSwitch.commit();
	#endif
	return 0;
}
int32_t RealTimeGetAlarmSwtich(RTAlarmSwitch *pSwitch)
{
	if( NULL == pSwitch)  return 1;
	LOGD("RealTimeSuspend_Callback\n");
	#if 0
	CConfigAlarmSwitch cfgAlarmSwitch;
	cfgAlarmSwitch.update();
	CONFIG_ALARMSWITCH &cfgSwitch = cfgAlarmSwitch.getConfig();

	memset(pSwitch,0,sizeof(RTAlarmSwitch));
	if(FALSE == cfgSwitch.bCryEnable){
		pSwitch->AlarmSwitch_Cry = RT_ALARM_CLOSE;
	}
	else{
		pSwitch->AlarmSwitch_Cry = RT_ALARM_OPEN;
	}
	
	if(FALSE == cfgSwitch.bMotionEnable){
		pSwitch->AlarmSwitch_Motion = RT_ALARM_CLOSE;
	}
	else{
		pSwitch->AlarmSwitch_Motion = RT_ALARM_OPEN;
	}
	
	if(FALSE == cfgSwitch.bHumanEnable){
		pSwitch->AlarmSwitch_Human = RT_ALARM_CLOSE;
	}
	else{
		pSwitch->AlarmSwitch_Human = RT_ALARM_OPEN;
	}
	
	if(FALSE == cfgSwitch.bVoiceEnable){
		pSwitch->AlarmSwitch_Voice = RT_ALARM_CLOSE;
	}
	else{
		pSwitch->AlarmSwitch_Voice = RT_ALARM_OPEN;
	}
	
	if(FALSE == cfgSwitch.bTraceEnable){
		pSwitch->AlarmSwitch_Trace = RT_ALARM_CLOSE;
	}
	else{
		pSwitch->AlarmSwitch_Trace = RT_ALARM_OPEN;
	}	
	#endif
	return 0;
}

int32_t  RealTimeSuspend_Callback(RTSystemStatus mode)
{
	LOGD("RealTimeSuspend_Callback\n");
	#if 0
	CConfigGeneral cCfgGeneral;

	cCfgGeneral.update();
	CONFIG_GENERAL &config	= cCfgGeneral.getConfig();
#ifdef  SUNING
	g_RecordTsManager.SetSuspendMode(mode); 
#endif

	if(mode == RT_SYSTEM_SUSPEND){
		config.iSuspendMode = 1;

#ifdef 	MP3PLAYWITHURL
		//stop mp3 playing
		g_MP3Play.MP3PlayStop();
#endif
	}
	else{
		config.iSuspendMode = 0;
	}

	cCfgGeneral.commit();
	#endif
	return 0;
}

RTSystemStatus RealTimeGetCurSystemStatus_Callback()
{
	RTSystemStatus mode = RT_SYSTEM_NORMAL;
	LOGD("RealTimeGetCurSystemStatus_Callback\n");
	#if 0
	LOGD("RealTimeGetCurSystemStatus_Callback\n");

	CConfigGeneral cCfgGeneral;
	RTSystemStatus mode;

	cCfgGeneral.update();
	CONFIG_GENERAL &config	= cCfgGeneral.getConfig();
	if(config.iSuspendMode == 1){
		mode = RT_SYSTEM_SUSPEND;
	}
	else{
		mode = RT_SYSTEM_NORMAL;
	}
	#endif
	return mode;
}

int32_t  RealTimeSetCurToPtzPoint_Callback(int id,int opt/*0:add,1:del*/)
{
	LOGD("RealTimeSetCurToPtzPoint_Callback\n");
	#if 0
	if(id < 0 || id >= MAXNUM_POINT){
			return 1;
		}
	
	CConfigPtzTrace cCfgPtzTrace;

	cCfgPtzTrace.update();
	CONFIG_TRACE &config = cCfgPtzTrace.getConfig();

	if(!opt){
		config.sPoint[id].Enable = 1;
		GetMotorPresetPos(&(config.sPoint[id].x),&(config.sPoint[id].y));
		_printd("id:%d...enable:%d,x:%d,y:%d",id,
			config.sPoint[id].Enable,config.sPoint[id].x,config.sPoint[id].y);
	}
	else{
		config.sPoint[id].Enable = 0;
	}
	cCfgPtzTrace.commit();
	#endif
	return 0;
}



int32_t RealTimeAKeyToShelter_Callback()
{
	LOGD("RealTimeAKeyToShelter_Callback\n");
	return 0;
}

int32_t RealTimeGetLockInfo_Callback(RT_DoorLockinfo *LockInfo)
{
	if( NULL == LockInfo) return 1;
	LOGD("RealTimeGetLockInfo_Callback\n");
	return 0;
}

int32_t RealTimeSetLockTempPsw_Callback(RT_DoorLockTempPasswd LockInfo)
{
	LOGD("RealTimeSetLockTempPsw_Callback time:%d,psd:%s,num:%d\n",LockInfo.Time,LockInfo.Passwd,LockInfo.ValidNums);
	return 0;
}

int32_t RealTimeGetLockTime_Callback(RT_DateTime *TimeInfo)
{
	if( NULL == TimeInfo) return 1;
	LOGD("RealTimeGetLockTime_Callback\n");
	return 0;
}

int32_t RealTimeSetLockTime_Callback(RT_DateTime TimeInfo)
{
	LOGD("RealTimeSetLockTime_Callback %04d-%02d-%02d\n",TimeInfo.m_year,TimeInfo.m_month,TimeInfo.m_day);
	return 0;
}

int32_t RealTimeLockOperate_Callback(RT_DoorLockOperate LockInfo)
{
	LOGD("RealTimeLockOperate_Callback time:%d,psd:%s,Action:%d\n",LockInfo.Time,LockInfo.Passwd,LockInfo.Action);
	return 0;
}

int32_t RealTimeGetLockVersion_Callback(RT_DoorLockVersion *VerInfo)
{
	if( NULL == VerInfo) return 1;
	LOGD("RealTimeGetLockVersion_Callback\n");
	return 0;
}

int32_t RealTimeSetExtLedSwitch(RT_ABLE val /*0:enable 1:unable*/)
{
	LOGD("RealTimeSetExtLedSwitch :%d\n",val);
	return 0;
}

/*0:enable 1:unable*/
RT_ABLE RealTimeGetExtLedSwitch()
{
	LOGD("RealTimeGetExtLedSwitch\n");
	return RT_ENABLE;
}

int32_t RealTimeLockAddLeaveMessage(RT_LockLeaveMessage info,int *pId/*添加的ID*/)
{
	LOGD("RealTimeLockAddLeaveMessage\n");
	return 0;
}

int32_t RealTimeLockDelLeaveMessage(int id)
{
	LOGD("RealTimeLockDelLeaveMessage\n");
	return 0;
}

int32_t RealTimeLockEditLeaveMessage(RT_LockLeaveMessage info,int id)
{
	LOGD("RealTimeLockEditLeaveMessage\n");
	return 0;
}

int32_t RealTimeGetLockLeaveMessage(RT_LockLeaveMessageList *pList)
{
	LOGD("RealTimeGetLockLeaveMessage\n");
	return 0;
}

int32_t  RealTimeGetLockUserInfo_Callback(RT_LockUserList *pList)
{
	LOGD("RealTimeGetLockUserInfo_Callback\n");
	return 0;
}

int32_t  RealTimeGetDeviceCMEI_Callback(char cmei[RT_CMEI_LEN])
{
	LOGD("RealTimeGetDeviceCMEI_Callback\n");
	return 0;
}

int32_t RealTimeSetTimerTask(RT_TIMER_TASK taskInfo,RT_TIMERTASK_CTRL ctrl)
{
	LOGD("RealTimeSetTimerTask\n");
	return 0;
}

int32_t RealTimeGetTimerTaskList(RT_TIMER_TASK_LIST *pTaskList)
{
	LOGD("RealTimeGetTimerTaskList\n");
	return 0;
}

int32_t RealTimeManualOperation(TIMERTASK_TYPE opt,RT_ABLE enable)
{
	LOGD("RealTimeManualOperation\n");
	return 0;
}

int32_t RealTimeGetOperationCfg(TIMERTASK_TYPE opt,RT_ABLE *pEnable)
{	
	LOGD("RealTimeGetOperationCfg\n");
	return 0;
}

int32_t RealTimeSetPirPushMsgLevel(RT_PirPushMsgLevel pushLevel)
{
	//app open pushLevel=2 close pushLevel=0
	//app no send MSG  pushLevel =1  
	//app send MSF  pushLevel =1
	LOGE("RealTimeSetPirPushMsgLevel pushLevel=%d\n", pushLevel);
	int nstat = pushLevel;

    if(RT_PIR_PUSH_MSG_OFF == pushLevel){//0
        DevConfigSetPirSwitch(nstat);
    }else{//1 2 3
        DevConfigSetPirSwitch(nstat);
    }

	return 0;
}

int32_t RealTimeGetPirPushMsgLevel(RT_PirPushMsgLevel *pPushLevel)
{	
	int  nstat = 0;

    if (0 != DevConfigGetPirSwitch(&nstat)) {
        LOGE("DevConfigGetPirSwitch failed\n");
        return -1;
    }
	*pPushLevel = nstat;
	LOGE("RealTimeGetPirPushMsgLevel pristat=%d\n", *pPushLevel);
	return 0;
}

int32_t RealTimeSetLockWarnVoice(char *url)
{
	LOGD("RealTimeSetLockWarnVoice\n");
	return 0;
}

int32_t RealTimeGetLockWarnVoice(char *url)
{
	LOGD("RealTimeGetLockWarnVoice\n");
	return 0;
}

int32_t RealTimeSetDevPowerSaveLevel(RT_PowerSaveLevel powerLevel)
{
	LOGE("RealTimeSetDevPowerSaveLevel  powerLevel=%d\n", powerLevel);
	#if 0
	int nstat = powerLevel;
	if(RT_POWER_SAVE_CLOSE == powerLevel){//0
		//action
		//DevSetPowerStat(nstat);
	}else if(RT_POWER_SAVE_PRIMARY == powerLevel){
		//action
		//DevSetPowerStat(nstat);
	}else if(RT_POWER_SAVE_SUPER == powerLevel){
		//action
		//DevSetPowerStat(nstat);
	}
	#endif
	return 0;
}

int32_t RealTimeGetDevPowerSaveLevel(RT_PowerSaveLevel *pPowerLevel)
{
	LOGE("RealTimeGetDevPowerSaveLevel\n");
	return 0;
}

int32_t RealTimeGetClothesHangerStatus_Callback(RT_ClothesHangerStatus *pStatus)
{
	LOGD("RealTimeGetClothesHangerStatus_Callback\n");
	return 0;
}

int32_t RealTimeGetDelayTaskList(RT_DELAY_TASK_LIST *pTaskList)
{
	LOGD("RealTimeGetDelayTaskList\n");
	return 0;
}

int32_t RealTimeSetDelayTask(RT_DELAY_TASK taskInfo,RT_TIMERTASK_CTRL ctrl,int *pOutId/*添加任务时,需要返回对应任务的id*/)
{
	LOGD("RealTimeSetDelayTask\n");
	return 0;	
}

int32_t RealTimeGetSnapPicture(char **pSnapBuf,int *pSnapSize)
{
    int ret = 0;
	LOGD("RealTimeGetSnapPicture\n");
	
	ret = VideoGetOpsHandle()->get_snap_pic(pSnapBuf, pSnapSize);
	if (ret < 0) {
        return -1;
	}

	return 0;
}

int32_t RealTimeGetRecordVideo(char **pVideoBuf,int *PVideoSize)
{
	LOGD("RealTimeGetRecordVideo\n");
	return 0;
}
//mp3 child
int32_t RealTimeSetMp3Url(char url[1024],int priority/*the biger ,the higher*/)
{
	LOGD("RealTimeSetMp3Url URL:%s \n",url);
	return 0;
}
int32_t  RealTimeMp3PlayCtrl(RT_Mp3PlayCtrl ctrl)
{
	LOGD("RealTimeMp3PlayCtrl\n");
	return 0;
}
int32_t  RealTimeGetMp3PlayStatus(char url[1024])
{
	LOGD("RealTimeGetMp3PlayStatus\n");
	return 0;
}
int32_t  RealTimeSetLedStatus(int val /*0:open 1:close*/)
{
	LOGD("SetLedStatus :%d\n",val);
	return 0;
}

int32_t RealTimeSetAudioOutVolume(int val)
{
	LOGE("RealTimeSetAudioOutVolume :%d\n",val);

    /* 智生活平台,目前只修改对讲的播放音量 */
    PLAY_VOLUME_CONFIG stPlayVol = {-1, -1, -1, -1};
    stPlayVol.talkbackVol = val;
    
    return AudioGetOpsHandle()->set_play_volume(stPlayVol);
}

int32_t RealTimeGetAudioOutVolume()
{
	int nVolume = 0;

	/* 智生活平台,目前只获取对讲的播放音量 */
    PLAY_VOLUME_CONFIG stPlayVol;
    AudioGetOpsHandle()->get_play_volume(&stPlayVol);
    nVolume = stPlayVol.talkbackVol;
    
	LOGD("RealTimeGetAudioOutVolume nVolume=%d\n",nVolume);
	return nVolume;
}
//nvr
int32_t RealTimeSystemTimeSynchronization_Callback(int32_t timestamps)
{
	return 0;
}
int32_t RealTimeNVRAddFaceInfo_Callback(RT_ModNewFaceInfo FaceInfo)
{
	return 0;
}
int32_t RealTimeNVRDelFaceInfo_Callback(RT_ModifyFaceInfo FaceInfo)
{
	return 0;
}
int32_t RealTimeNVRChangeFaceInfo_Callback(RT_ModifyFaceInfo ModifyFaceInfo,RT_ModNewFaceInfo ModNewFaceInfo)
{
	return 0;
}
int32_t RealTimeNVRQueryFaceInfo_Callback(RT_QueryFaceInfo QueryFaceInfo,RT_QueryRespFaceInfo *RespFaceInfo)
{	
	return 0;
}
//ptz
int32_t RealTimePTZCmd_Callback(uint8_t channel,RT_PTZControlCmd ptzcmd, RT_ControlArgData* arg)
{	
	return 0;
}
int32_t RealTimePTZClose_Callback(uint8_t channel)
{
	return 0;
}
int32_t RealTimeGetAllPtzPoint_Callback(RT_ALLPresetPointInfo *pInfo)
{
	return 0;
}
int32_t RealTimeSetPtzTraceRoute_Callback(RT_SetTraceRoute route)
{
	return 0;
}
int32_t RealTimeGetPtzTraceRoute_Callback(RT_SetTraceRoute *pRoute)
{
	return 0;
}
//晾衣架开关
int32_t RealTimeSetClothesHangerPower_Callback(RT_ABLE enable)
{
	return 0;
}
//晾衣架升降电机
int32_t RealTimeSetClothesHangerMotor_Callback(RT_PTZControlCmd ptzcmd)
{
	return 0;
}
//消毒开关
int32_t RealTimeSetDisinfectionPower_Callback(RT_ABLE enable)
{
	return 0;
}
//烘干开关
int32_t RealTimeSetHotdryPower_Callback(RT_ABLE enable)
{
	return 0;
}
//风干开关
int32_t RealTimeSetWinddryPower_Callback(RT_ABLE enable)
{
	return 0;
}
//QT2
int32_t RealTimeQt2GetLoginStatus_Callback(int *pResult)
{
	return 0;
}
int32_t  RealTimeQt2SetLoginInfo(char account[128], char token[128], char appid[32])
{
	return 0;
}
int32_t RealtimeQt2DevRefuseCall(int calltype)
{
	return 0;
}
int32_t RealtimeQt2DevHangUpCall(int calltype)
{
	return 0;
}
//feed_dog_interface  
int32_t RealTimeSetFeedDeviceServing(int weight)
{
	return 0;
}
int32_t RealTimeSetFeedAlarmParam(int weight)
{
	return 0;
}
int32_t  RealTimeSetFeedVoiceUrl(char* pUrl)
{
	return 0;
}
int32_t RealTimeGetFeedVoiceUrl(char *pUrl, int nSize)
{
	return 0;
}
int32_t RealTimeSetDelTimeTask(RT_FEEDSHEETPLAN *pfeedplan)
{
	return 0;
}
int32_t RealTimeFeedResetWeight()
{
	return 0;
}
int32_t RealTimeSetChangeTimeTask(int flagParam, RT_FEEDSHEETPLAN *pfeedplan)
{
	return 0;
}
int32_t RealTimeSetAddTimeTask(RT_FEEDSHEETPLAN *pfeedplan, int *pIndex)
{
	return 0;
}
int32_t	RealTimeGetFeedPlanList_Callback(RT_FEEDPLANLIST *pFeedPlanList)
{
	return 0;
}
int32_t RealTimeFeedGetFoodWeight(int *pFoodWeight)
{
	return 0;
}
int32_t RealTimeFeedGetAlarmWeight(int *pAlarmWeight)
{
	return 0;
}

int32_t RealTimeGetMoveSensitive_Callback(int *move_sensitive)
{
    if (move_sensitive == NULL) {
        LOGE("move_sensitive is invalid\n");
        return -1;
    }

    DevConfigGetPirLevel((char *)move_sensitive);

    LOGD("RealTimeGetMoveSensitive_Callback move_sensitive=%d\n", *move_sensitive);

    return 0;
}

int32_t RealTimeSetMoveSensitive_Callback(int move_sensitive)
{
    int ret = 0;
    
    ret = DevConfigSetPirLevel(move_sensitive);
    if (ret < 0) {
        LOGE("DevConfigSetPirLevel failed\n");
        return -1;
    }

    LOGD("RealTimeSetMoveSensitive_Callback move_sensitive=%d\n", move_sensitive);
    
    return 0;
}

